package com.orangelife.mobile.lookRepair.adapter;

import java.util.List;
import java.util.Map;

import com.curry.android.util.ImageDownloader;
import com.curry.android.util.ImageDownloader.ImageSize;
import com.curry.orangelife.mobile.R;
import com.orangelife.mobile.lookRepair.adapter.LookForRepairListAdapter.ViewHolder;
import com.orangelife.mobile.lookRepair.adapter.LookForRepairListAdapter.listener;
import com.orangelife.mobile.util.DateUtil;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class LookRepairGridViewAdapter extends BaseAdapter {
	
	private Context context;
	private List<String> list;
	private ImageDownloader image = ImageDownloader.getImageDownloader();

	public LookRepairGridViewAdapter(Context context,List<String> list) {
		this.context = context;
		this.list = list;
	}
	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(R.layout.item_gv_lookrepair, null);
			holder.ivPhoto = (ImageView)convertView.findViewById(R.id.ivPhoto);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		image.download(list.get(position), holder.ivPhoto,
				ImageSize.IMAGE_SIZE_EXTRA_SMALL_RECTANGLE_JPG);
		
		return convertView;
	}
	
	class ViewHolder{
		/**图片*/
		private ImageView ivPhoto;
	}

}
